package com.sskj.bibi.bean;

import com.sskj.lib.util.CommonUtil;
import com.sskj.lib.util.NumberUtil;

public class RecordHistoryBean {

    /**
     * id : 9533
     * tradeType : 2
     * stockCode : ETH/USDT
     * dealTime : 2019-06-24 17:34:10
     * billPriceType : 2
     * entrustPrice : 260000
     * totalPrice : 100
     * dealTotalPrice : 0
     * dealPrice : 0
     * dealsRemainNum : 0
     * state : 3
     */

    private String id;
    private int tradeType;
    private String stockCode;
    private String dealTime;
    private int billPriceType;
    private String entrustPrice;
    private String totalPrice;
    private String dealTotalPrice;
    private String dealPrice;
    private String dealsRemainNum;
    private int state;
    private String totalNum;

    public String getTotalNum() {
        if (stockCode.contains("DIG")){
            return NumberUtil.keep(totalNum,NumberUtil.bibiBIBNumber);
        }
        return totalNum;
    }

    public void setTotalNum(String totalNum) {
        this.totalNum = totalNum;
    }

    public boolean isBuyAndMarket(){
        return (tradeType==1&&billPriceType==1);
    }
    public String getLCode(){
        if (stockCode==null){
            return stockCode;
        }
        return stockCode.replace("_","/").toUpperCase().split("/")[0];
    }
    public String getRCode(){
        if (stockCode==null){
            return stockCode;
        }
        return stockCode.replace("_","/").toUpperCase().split("/")[1];
    }

    public boolean isBuy(){
        return tradeType==1;
    }
    public boolean isMarket(){
        return billPriceType==1;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getTradeType() {
        return tradeType;
    }

    public void setTradeType(int tradeType) {
        this.tradeType = tradeType;
    }

    public String getStockCode() {
        return stockCode;
    }

    public void setStockCode(String stockCode) {
        this.stockCode = stockCode;
    }

    public String getDealTime() {
        return dealTime.substring(5);
    }

    public void setDealTime(String dealTime) {
        this.dealTime = dealTime;
    }

    public int getBillPriceType() {
        return billPriceType;
    }

    public void setBillPriceType(int billPriceType) {
        this.billPriceType = billPriceType;
    }

    public String getEntrustPrice() {
        return CommonUtil.dealTradeBibi(entrustPrice);
    }

    public void setEntrustPrice(String entrustPrice) {
        this.entrustPrice = entrustPrice;
    }

    public String getTotalPrice() {
        return CommonUtil.dealTradeBibi(totalPrice);
    }

    public void setTotalPrice(String totalPrice) {
        this.totalPrice = totalPrice;
    }

    public String getDealTotalPrice() {
        return CommonUtil.dealTradeBibi(dealTotalPrice);
    }

    public void setDealTotalPrice(String dealTotalPrice) {
        this.dealTotalPrice = dealTotalPrice;
    }

    public String getDealPrice() {
        return CommonUtil.dealTradeBibi(dealPrice);
    }

    public void setDealPrice(String dealPrice) {
        this.dealPrice = dealPrice;
    }

    public String getDealsRemainNum() {
        if (stockCode.contains("DIG")){
            return NumberUtil.keep(dealsRemainNum,NumberUtil.bibiBIBNumber);
        }
        return CommonUtil.dealTradeBibi(dealsRemainNum);
    }

    public void setDealsRemainNum(String dealsRemainNum) {
        this.dealsRemainNum = dealsRemainNum;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }
}
